package com.dhcc.DRGsHosp.facade.impl.assembler;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.dhcc.DRGsHosp.core.domain.MedicalRecord;
import com.dhcc.DRGsHosp.facade.dto.MedicalRecordDTO;

public class MedicalRecordAssembler {
	
	public static MedicalRecordDTO  toDTO(MedicalRecord  medicalRecord){
		if (medicalRecord == null) {
			return null;
		}
    	MedicalRecordDTO result  = new MedicalRecordDTO();
//	    	result.setId (medicalRecord.getId());
     	    	result.setRecordId (medicalRecord.getRecordId());
     	    	result.setPatientId (medicalRecord.getPatientId());
     	    	result.setMrNo (medicalRecord.getMrNo());
     	    	result.setPatientName (medicalRecord.getPatientName());
     	    	result.setSex (medicalRecord.getSex());
     	    	result.setAgeYear (medicalRecord.getAgeYear());
     	    	result.setAgeMonth (medicalRecord.getAgeMonth());
     	    	result.setAgeDays (medicalRecord.getAgeDays());
     	    	result.setMarriage (medicalRecord.getMarriage());
     	    	result.setDayOfbirth (medicalRecord.getDayOfbirth());
     	    	result.setInDate (medicalRecord.getInDate());
     	    	result.setInDepcode (medicalRecord.getInDepcode());
     	    	result.setInDep (medicalRecord.getInDep());
     	    	result.setInWardcode (medicalRecord.getInWardcode());
     	    	result.setInWard (medicalRecord.getInWard());
     	    	result.setOutWay (medicalRecord.getOutWay());
     	    	result.setInWay (medicalRecord.getInWay());
     	    	result.setIpCount (medicalRecord.getIpCount());
     	    	result.setOpDiagnosiscode (medicalRecord.getOpDiagnosiscode());
     	    	result.setOpDiagnosis (medicalRecord.getOpDiagnosis());
     	    	result.setOutDate (medicalRecord.getOutDate());
     	    	result.setOutDepcode (medicalRecord.getOutDepcode());
     	    	result.setOutDep (medicalRecord.getOutDep());
     	    	result.setDepMastercode (medicalRecord.getDepMastercode());
     	    	result.setDepMaster (medicalRecord.getDepMaster());
     	    	result.setProtomedicusCode (medicalRecord.getProtomedicusCode());
     	    	result.setProtomedicus (medicalRecord.getProtomedicus());
     	    	result.setPhysicianCode (medicalRecord.getPhysicianCode());
     	    	result.setPhysician (medicalRecord.getPhysician());
     	    	result.setResidentDoctorcode (medicalRecord.getResidentDoctorcode());
     	    	result.setResidentDoctor (medicalRecord.getResidentDoctor());
     	    	result.setPhysicianLearncode (medicalRecord.getPhysicianLearncode());
     	    	result.setPhysicianLearn (medicalRecord.getPhysicianLearn());
     	    	result.setInternCode (medicalRecord.getInternCode());
     	    	result.setIntern (medicalRecord.getIntern());
     	    	result.setNurseCode (medicalRecord.getNurseCode());
     	    	result.setNurse (medicalRecord.getNurse());
     	    	result.setPayment (medicalRecord.getPayment());
     	    	result.setCostamount (medicalRecord.getCostamount());
     	    	result.setCostself (medicalRecord.getCostself());
     	    	result.setDangerlevel (medicalRecord.getDangerlevel());
     	    	result.setDrugcost (medicalRecord.getDrugcost());
     	    	result.setPargroupName (medicalRecord.getPargroupName());
     	    	result.setDiagnoseCodemain (medicalRecord.getDiagnoseCodemain());
     	    	result.setDiagnoseDessmain (medicalRecord.getDiagnoseDessmain());
     	    	result.setNewbornWeight (medicalRecord.getNewbornWeight());
     	    	result.setNewbornDays (medicalRecord.getNewbornDays());
     	    	result.setVentilatorHour (medicalRecord.getVentilatorHour());
     	    	result.setInDays (medicalRecord.getInDays());
     	    	result.setMaterialcost (medicalRecord.getMaterialcost());
     	    return result;
	 }
	
	public static List<MedicalRecordDTO>  toDTOs(Collection<MedicalRecord>  medicalRecords){
		if (medicalRecords == null) {
			return null;
		}
		List<MedicalRecordDTO> results = new ArrayList<MedicalRecordDTO>();
		for (MedicalRecord each : medicalRecords) {
			results.add(toDTO(each));
		}
		return results;
	}
	
	 public static MedicalRecord  toEntity(MedicalRecordDTO  medicalRecordDTO){
	 	if (medicalRecordDTO == null) {
			return null;
		}
	 	MedicalRecord result  = new MedicalRecord();
        result.setId (medicalRecordDTO.getId());
         result.setRecordId (medicalRecordDTO.getRecordId());
         result.setPatientId (medicalRecordDTO.getPatientId());
         result.setMrNo (medicalRecordDTO.getMrNo());
         result.setPatientName (medicalRecordDTO.getPatientName());
         result.setSex (medicalRecordDTO.getSex());
         result.setAgeYear (medicalRecordDTO.getAgeYear());
         result.setAgeMonth (medicalRecordDTO.getAgeMonth());
         result.setAgeDays (medicalRecordDTO.getAgeDays());
         result.setMarriage (medicalRecordDTO.getMarriage());
         result.setDayOfbirth (medicalRecordDTO.getDayOfbirth());
         result.setInDate (medicalRecordDTO.getInDate());
         result.setInDepcode (medicalRecordDTO.getInDepcode());
         result.setInDep (medicalRecordDTO.getInDep());
         result.setInWardcode (medicalRecordDTO.getInWardcode());
         result.setInWard (medicalRecordDTO.getInWard());
         result.setOutWay (medicalRecordDTO.getOutWay());
         result.setInWay (medicalRecordDTO.getInWay());
         result.setIpCount (medicalRecordDTO.getIpCount());
         result.setOpDiagnosiscode (medicalRecordDTO.getOpDiagnosiscode());
         result.setOpDiagnosis (medicalRecordDTO.getOpDiagnosis());
         result.setOutDate (medicalRecordDTO.getOutDate());
         result.setOutDepcode (medicalRecordDTO.getOutDepcode());
         result.setOutDep (medicalRecordDTO.getOutDep());
         result.setDepMastercode (medicalRecordDTO.getDepMastercode());
         result.setDepMaster (medicalRecordDTO.getDepMaster());
         result.setProtomedicusCode (medicalRecordDTO.getProtomedicusCode());
         result.setProtomedicus (medicalRecordDTO.getProtomedicus());
         result.setPhysicianCode (medicalRecordDTO.getPhysicianCode());
         result.setPhysician (medicalRecordDTO.getPhysician());
         result.setResidentDoctorcode (medicalRecordDTO.getResidentDoctorcode());
         result.setResidentDoctor (medicalRecordDTO.getResidentDoctor());
         result.setPhysicianLearncode (medicalRecordDTO.getPhysicianLearncode());
         result.setPhysicianLearn (medicalRecordDTO.getPhysicianLearn());
         result.setInternCode (medicalRecordDTO.getInternCode());
         result.setIntern (medicalRecordDTO.getIntern());
         result.setNurseCode (medicalRecordDTO.getNurseCode());
         result.setNurse (medicalRecordDTO.getNurse());
         result.setPayment (medicalRecordDTO.getPayment());
         result.setCostamount (medicalRecordDTO.getCostamount());
         result.setCostself (medicalRecordDTO.getCostself());
         result.setDangerlevel (medicalRecordDTO.getDangerlevel());
         result.setDrugcost (medicalRecordDTO.getDrugcost());
         result.setPargroupName (medicalRecordDTO.getPargroupName());
         result.setDiagnoseCodemain (medicalRecordDTO.getDiagnoseCodemain());
         result.setDiagnoseDessmain (medicalRecordDTO.getDiagnoseDessmain());
         result.setNewbornWeight (medicalRecordDTO.getNewbornWeight());
         result.setNewbornDays (medicalRecordDTO.getNewbornDays());
         result.setVentilatorHour (medicalRecordDTO.getVentilatorHour());
         result.setInDays (medicalRecordDTO.getInDays());
         result.setMaterialcost (medicalRecordDTO.getMaterialcost());
 	  	return result;
	 }
	
	public static List<MedicalRecord> toEntities(Collection<MedicalRecordDTO> medicalRecordDTOs) {
		if (medicalRecordDTOs == null) {
			return null;
		}
		
		List<MedicalRecord> results = new ArrayList<MedicalRecord>();
		for (MedicalRecordDTO each : medicalRecordDTOs) {
			results.add(toEntity(each));
		}
		return results;
	}
}
